home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4629 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  56 lines

  1. Newsgroups: comp.lang.c,comp.unix.shell,comp.unix.programmer,comp.unix.questions
  2. Path: tmai.com!usenet
  3. From: sridhar_panchapakesan@tmai.com (Sridhar Panchapakesan)
  4. Subject: 'getopt' problem..
  5. X-Nntp-Posting-Host: 205.159.65.69
  6. Message-ID: <SRIDHAR_PANCHAPAKESAN.96Feb5162934@compton.tmai.com>
  7. Sender: usenet@tmai.com (usenet acct for news)
  8. Organization: Technology Modeling Associates, Inc.
  9. Date: Tue, 6 Feb 1996 00:29:33 GMT
  10.  
  11. I am trying to use 'getopt' to read a quoted string as options for a
  12. program. It works fine when I try it from a shell (csh) but when I try
  13. running it from a script using 'exec' it does not accept the entire the
  14. entire quoted string as the option.
  15.  
  16. e.g. ( test is the program name)
  17. % test -f "-g -o 5" in.txt
  18. ( getopt works fine. The string "-g -o 5" is read correctly into
  19. optargs. Note that I have to use '-' (dash) in the string as a
  20. requirement of the program itself.)
  21.  
  22. However when I try it from the script file:
  23.  
  24. exec test -f "\"-g -o 5\"" in.txt
  25.  
  26. The getopt only recognizes "-g as the option for -f instead of "-g -o
  27. 5".
  28.  
  29. I would appreciate any help in this area..
  30.  
  31. - Sridhar.
  32.  
  33.  
  34. -----------------------------------------------------------------------------
  35. sridhar panchapakesan, member of technical staff
  36. e-mail: sridhar_panchapakesan@tmai.com
  37. phone : (415) 856-8862 x279     fax : (415) 856-8860
  38. technology modeling associates, inc. (http://www.tmai.com)    
  39.        __o              
  40.          _ \<,_                   
  41.         (*)/ (*) 
  42.          -----     Save Earth
  43. -----------------------------------------------------------------------------
  44. -- 
  45.  
  46. -----------------------------------------------------------------------------
  47. sridhar panchapakesan, member of technical staff
  48. e-mail: sridhar_panchapakesan@tmai.com
  49. phone : (415) 856-8862 x279     fax : (415) 856-8860
  50. technology modeling associates, inc. (http://www.tmai.com)    
  51.        __o              
  52.          _ \<,_                   
  53.         (*)/ (*) 
  54.          -----     Save Earth
  55. -----------------------------------------------------------------------------
  56.